/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.jili.ubert.dao.recent;

import java.io.Serializable;
import com.baidu.bjf.remoting.protobuf.Codec;
import com.baidu.bjf.remoting.protobuf.ProtobufProxy;
import com.baidu.bjf.remoting.protobuf.annotation.Protobuf;
import com.jili.ubert.code.CodeTool;
import java.io.IOException;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author dragon
 */
@Entity
@Table(name = "recent_trade_alterorder")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "RecentTradeAlterOrder.findAll", query = "SELECT r FROM RecentTradeAlterOrder r"),
    @NamedQuery(name = "RecentTradeAlterOrder.findById", query = "SELECT r FROM RecentTradeAlterOrder r WHERE r.id = :id"),
    @NamedQuery(name = "RecentTradeAlterOrder.findByOrderID", query = "SELECT r FROM RecentTradeAlterOrder r WHERE r.orderID = :orderID"),
    @NamedQuery(name = "RecentTradeAlterOrder.findByDealerUserID", query = "SELECT r FROM RecentTradeAlterOrder r WHERE r.dealerUserID = :dealerUserID"),
    @NamedQuery(name = "RecentTradeAlterOrder.findByAccountCode", query = "SELECT r FROM RecentTradeAlterOrder r WHERE r.accountCode = :accountCode"),
    @NamedQuery(name = "RecentTradeAlterOrder.findByTime", query = "SELECT r FROM RecentTradeAlterOrder r WHERE r.time = :time"),
    @NamedQuery(name = "RecentTradeAlterOrder.findByTradeDate", query = "SELECT r FROM RecentTradeAlterOrder r WHERE r.tradeDate = :tradeDate"),
    @NamedQuery(name = "RecentTradeAlterOrder.findByDateTime", query = "SELECT r FROM RecentTradeAlterOrder r WHERE r.dateTime = :dateTime"),
    @NamedQuery(name = "RecentTradeAlterOrder.findByMac", query = "SELECT r FROM RecentTradeAlterOrder r WHERE r.mac = :mac"),
    @NamedQuery(name = "RecentTradeAlterOrder.findByIp4", query = "SELECT r FROM RecentTradeAlterOrder r WHERE r.ip4 = :ip4"),
    @NamedQuery(name = "RecentTradeAlterOrder.findByOrderTypeEmit", query = "SELECT r FROM RecentTradeAlterOrder r WHERE r.orderTypeEmit = :orderTypeEmit"),
    @NamedQuery(name = "RecentTradeAlterOrder.findByTradeOperate", query = "SELECT r FROM RecentTradeAlterOrder r WHERE r.tradeOperate = :tradeOperate"),
    @NamedQuery(name = "RecentTradeAlterOrder.findByEntrustNo", query = "SELECT r FROM RecentTradeAlterOrder r WHERE r.entrustNo = :entrustNo"),
    @NamedQuery(name = "RecentTradeAlterOrder.findByEntrustkey", query = "SELECT r FROM RecentTradeAlterOrder r WHERE r.entrustkey = :entrustkey"),
    @NamedQuery(name = "RecentTradeAlterOrder.findByAlterQty", query = "SELECT r FROM RecentTradeAlterOrder r WHERE r.alterQty = :alterQty"),
    @NamedQuery(name = "RecentTradeAlterOrder.findByAlterPrice", query = "SELECT r FROM RecentTradeAlterOrder r WHERE r.alterPrice = :alterPrice"),
    @NamedQuery(name = "RecentTradeAlterOrder.findByWorkStationID", query = "SELECT r FROM RecentTradeAlterOrder r WHERE r.workStationID = :workStationID"),
    @NamedQuery(name = "RecentTradeAlterOrder.findByOwnUserID", query = "SELECT r FROM RecentTradeAlterOrder r WHERE r.ownUserID = :ownUserID"),
    @NamedQuery(name = "RecentTradeAlterOrder.findByAlterUserID", query = "SELECT r FROM RecentTradeAlterOrder r WHERE r.alterUserID = :alterUserID"),
    @NamedQuery(name = "RecentTradeAlterOrder.findByCreateTime", query = "SELECT r FROM RecentTradeAlterOrder r WHERE r.createTime = :createTime"),
    @NamedQuery(name = "RecentTradeAlterOrder.findByTimeStamp", query = "SELECT r FROM RecentTradeAlterOrder r WHERE r.timeStamp = :timeStamp")})
public class RecentTradeAlterOrder implements Serializable {
	public static byte[] EnCode(RecentTradeAlterOrder msg) throws IOException {
		Codec<RecentTradeAlterOrder> Lcode = ProtobufProxy.create(RecentTradeAlterOrder.class);
		return Lcode.encode(msg);
	}
	public static RecentTradeAlterOrder DeCode(byte[] data) throws IOException {
	Codec<RecentTradeAlterOrder> Lcode = ProtobufProxy.create(RecentTradeAlterOrder.class);
		return Lcode.decode(data);
	}

    private static final long serialVersionUID = 1L;
    @Id
    //@GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    @Protobuf
	private Long id;
    @Basic(optional = false)
    @Column(name = "OrderID")
    @Protobuf
	private int orderID;
    @Basic(optional = false)
    @Column(name = "DealerUserID")
    @Protobuf
	private String dealerUserID;
    @Basic(optional = false)
    @Column(name = "AccountCode")
    @Protobuf
	private String accountCode;
    @Basic(optional = false)
    @Column(name = "Time")
    @Temporal(TemporalType.TIME)
    private Date time;
	@Protobuf
	private long timeL;
    @Basic(optional = false)
    @Column(name = "TradeDate")
    @Temporal(TemporalType.DATE)
    private Date tradeDate;
	@Protobuf
	private long tradeDateL;
    @Basic(optional = false)
    @Column(name = "DateTime")
    @Temporal(TemporalType.TIMESTAMP)
    private Date dateTime;
	@Protobuf
	private long dateTimeL;
    @Column(name = "Mac")
    @Protobuf
	private String mac;
    @Column(name = "IP4")
    @Protobuf
	private Integer ip4;
    @Basic(optional = false)
    @Column(name = "OrderTypeEmit")
    @Protobuf
	private String orderTypeEmit;
    @Basic(optional = false)
    @Column(name = "TradeOperate")
    @Protobuf
	private int tradeOperate;
    @Column(name = "EntrustNo")
    @Protobuf
	private Integer entrustNo;
    @Column(name = "Entrustkey")
    @Protobuf
	private String entrustkey;
    @Column(name = "AlterQty")
    @Protobuf
	private Integer alterQty;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "AlterPrice")
    @Protobuf
	private Float alterPrice;
    @Column(name = "WorkStationID")
    @Protobuf
	private String workStationID;
    @Column(name = "OwnUserID")
    @Protobuf
	private String ownUserID;
    @Column(name = "AlterUserID")
    @Protobuf
	private String alterUserID;
    @Column(name = "CreateTime")
    @Temporal(TemporalType.TIMESTAMP)
    private Date createTime;
	//@Protobuf
//tprivate long createTimeL;
    @Column(name = "TimeStamp")
    @Temporal(TemporalType.TIMESTAMP)
    private Date timeStamp;
	//@Protobuf
	//private long timeStampL;

    public RecentTradeAlterOrder() {
    }

    public RecentTradeAlterOrder(Long id) {
        this.id = id;
    }

    public RecentTradeAlterOrder(Long id, int orderID, String dealerUserID, String accountCode, Date time, Date tradeDate, Date dateTime, String orderTypeEmit, int tradeOperate) {
        this.id = id;
        this.orderID = orderID;
        this.dealerUserID = dealerUserID;
        this.accountCode = accountCode;
        this.time = time;
		this.timeL = CodeTool.DateToLong(time);
        this.tradeDate = tradeDate;
		this.tradeDateL = CodeTool.DateToLong(tradeDate);
        this.dateTime = dateTime;
		this.dateTimeL = CodeTool.DateToLong(dateTime);
        this.orderTypeEmit = orderTypeEmit;
        this.tradeOperate = tradeOperate;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public int getOrderID() {
        return orderID;
    }

    public void setOrderID(int orderID) {
        this.orderID = orderID;
    }

    public String getDealerUserID() {
        return dealerUserID;
    }

    public void setDealerUserID(String dealerUserID) {
        this.dealerUserID = dealerUserID;
    }

    public String getAccountCode() {
        return accountCode;
    }

    public void setAccountCode(String accountCode) {
        this.accountCode = accountCode;
    }

    public Date getTime() {
        return time;
    }

    public void setTime(Date time) {
        this.time = time;
        this.setTimeL(CodeTool.DateToLong(time));
    }

    public Date getTradeDate() {
        return tradeDate;
    }

    public void setTradeDate(Date tradeDate) {
        this.tradeDate = tradeDate;
		this.setTradeDateL(CodeTool.DateToLong(tradeDate));
    }

    public Date getDateTime() {
        return dateTime;
    }

    public void setDateTime(Date dateTime) {
        this.dateTime = dateTime;
		this.setDateTimeL(CodeTool.DateToLong(dateTime));
    }

    public String getMac() {
        return mac;
    }

    public void setMac(String mac) {
        this.mac = mac;
    }

    public Integer getIp4() {
        return ip4;
    }

    public void setIp4(Integer ip4) {
        this.ip4 = ip4;
    }

    public String getOrderTypeEmit() {
        return orderTypeEmit;
    }

    public void setOrderTypeEmit(String orderTypeEmit) {
        this.orderTypeEmit = orderTypeEmit;
    }

    public int getTradeOperate() {
        return tradeOperate;
    }

    public void setTradeOperate(int tradeOperate) {
        this.tradeOperate = tradeOperate;
    }

    public Integer getEntrustNo() {
        return entrustNo;
    }

    public void setEntrustNo(Integer entrustNo) {
        this.entrustNo = entrustNo;
    }

    public String getEntrustkey() {
        return entrustkey;
    }

    public void setEntrustkey(String entrustkey) {
        this.entrustkey = entrustkey;
    }

    public Integer getAlterQty() {
        return alterQty;
    }

    public void setAlterQty(Integer alterQty) {
        this.alterQty = alterQty;
    }

    public Float getAlterPrice() {
        return alterPrice;
    }

    public void setAlterPrice(Float alterPrice) {
        this.alterPrice = alterPrice;
    }

    public String getWorkStationID() {
        return workStationID;
    }

    public void setWorkStationID(String workStationID) {
        this.workStationID = workStationID;
    }

    public String getOwnUserID() {
        return ownUserID;
    }

    public void setOwnUserID(String ownUserID) {
        this.ownUserID = ownUserID;
    }

    public String getAlterUserID() {
        return alterUserID;
    }

    public void setAlterUserID(String alterUserID) {
        this.alterUserID = alterUserID;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
		//this.createTimeL = CodeTool.DateToLong(createTime);
    }

    public Date getTimeStamp() {
        return timeStamp;
    }

    public void setTimeStamp(Date timeStamp) {
        this.timeStamp = timeStamp;
		//this.timeStampL = CodeTool.DateToLong(timeStamp);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof RecentTradeAlterOrder)) {
            return false;
        }
        RecentTradeAlterOrder other = (RecentTradeAlterOrder) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.jili.ubert.dao.recent.RecentTradeAlterOrder[ id=" + id + " ]";
    }

    public long getTimeL() {
        return timeL;
    }

    public void setTimeL(long timeL) {
        this.timeL = timeL;
    }

    public long getTradeDateL() {
        return tradeDateL;
    }

    public void setTradeDateL(long tradeDateL) {
        this.tradeDateL = tradeDateL;
		this.tradeDate = CodeTool.LongToDate(tradeDateL);
    }

    public long getDateTimeL() {
        return dateTimeL;
    }

    public void setDateTimeL(long dateTimeL) {
        this.dateTimeL = dateTimeL;
		this.dateTime = CodeTool.LongToDate(dateTimeL);
    }
    
}
